﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CoreProcess;
using Personal_Resource_Management.View;


namespace Personal_Resource_Management
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private void test() { }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string tmp = @"D:\A_Development\MyProjects\Dotnet\MyProjects\Personal_Resource_Management\CoreProcess\TestFolder\12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\123456789012345678901234567890";
            LongPathSolution.GetShortPathName(tmp);

            #region Test Long Path
            string basepath = AppDomain.CurrentDomain.BaseDirectory;
            //string basepath1 = AppDomain.CurrentDomain.DynamicDirectory;

            string testfolder = basepath.Replace(@"bin\Debug", @"TestFolder");

            testfolder = testfolder + 
                        @"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\123456789012";
                //@"E:\Projects\MyProject\SVN\iceternally-dotnet-test\trunk\MyProjects\Personal_Resource_Management\CoreProcess\TestFolder\12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\123456789012";
                //@"E:\Projects\MYPROJ~1\SVN\ICETER~1\trunk\MYPROJ~1\PERSON~1\COREPR~1\TESTFO~1\123456~1\123456789012";
            LongPathSolution.GetShortPathName(testfolder);

            return;
            #endregion

            Action AC = new Action(test);


            FolderBrowserDialog folderBrowser = new FolderBrowserDialog();




            if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)

            {


                
                //ResourceScan.Scan(folderBrowser.SelectedPath, new Action(()=> {}) );
            }
            
        }

        private void ButtonScan_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var rs = new ResourceScan();
                rs.ScanResource(fbd.SelectedPath);
            }

            
        }

        private void ButtonResourceView_Click(object sender, RoutedEventArgs e)
        {
            new ResourceView().ShowDialog();
        }


    }
}
